import 'package:flutter/material.dart';
import 'package:flutter_namerouter_page/first_page.dart';
import 'package:flutter_namerouter_page/second_page.dart';
import 'package:flutter_namerouter_page/unknown_page.dart';

void main(List<String> args) => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      /// 路由表结构
      routes: {
        'first': (context) => FirstPage(),
        'second': (context) => SecondPage(),
      },

      /// 初始化页面
      initialRoute: 'first',

      /// 路由表中没有的页面会跳转到的地方
      onUnknownRoute: (RouteSettings setting) =>
          MaterialPageRoute(builder: (context) => UnKnownPage()),
    );
  }
}
